<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" href="__STATIC__/css/mui.min.css"/>
    <link rel="stylesheet" href="__STATIC__/css/swiper.min.css">
    <link rel="stylesheet" href="__STATIC__/css/common.css">
    <link rel="stylesheet" href="__STATIC__/css/module.css">
    <script src="__STATIC__/js/jquery.min.js"></script>
    <script src="__STATIC__/js/mui.min.js"></script>
    <script src="__STATIC__/js/swiper.jquery.min.js"></script>
</head>

<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-arrowleft mui-pull-left"></a>
    <h1 class="mui-title">订单</h1>
    <a href="#topPopover" class="mui-icon top-list-menu mui-pull-right"></a>
    <!-- <a href="#" class="mui-icon mui-icon-search mui-pull-right"></a> -->
</header>
<div id="topPopover"  class="mui-popover topRightMenu">
    <ul class="mui-table-view">
        <li class="mui-table-view-cell">
            <a href="#"><span class="ico ico1"></span>消息</a>
        </li>
        <li class="mui-table-view-cell">
            <a href="#"><span class="ico ico2"></span>首页</a>
        </li>
        <li class="mui-table-view-cell">
            <a href="#"><span class="ico ico3"></span>联系我们</a>
        </li>
        <li class="mui-table-view-cell">
            <a href="#"><span class="ico ico4"></span>我要反馈</a>
        </li>
    </ul>
</div>
<div class="mui-content">
    <div class="order-mui-tab">
        <div class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
            <a {if condition="$type eq 0"} class="mui-control-item mui-active" {else} class="mui-control-item" {/if}  href="{:url('index/User/order',array('type'=>0))}">
                全部({$arrs.zong})
            </a>
            <a {if condition="$type eq 1"} class="mui-control-item mui-active" {else} class="mui-control-item" {/if} href="{:url('index/User/order',array('type'=>1))}">
                待付款({$arrs.daifu})
            </a>
            <a {if condition="$type eq 3"} class="mui-control-item mui-active" {else} class="mui-control-item" {/if} href="{:url('index/User/order',array('type'=>3))}">
                待收货({$arrs.daishou})
            </a>
            <a {if condition="$type eq 4"} class="mui-control-item mui-active" {else} class="mui-control-item" {/if} href="{:url('index/User/order',array('type'=>4))}">
                待评价({$arrs.daiping})
            </a>
            <a {if condition="$type eq 5"} class="mui-control-item mui-active" {else} class="mui-control-item" {/if} href="{:url('index/User/order',array('type'=>5))}">
                已取消({$arrs.quxiao})
            </a>
        </div>
        <div class="mui-slider-group" style="margin-top: 44px;">
{if condition="$arr eq NULL"}
        <div class="mui-slider-item mui-control-content mui-active">
                <div class="nomessage">
                    <div class="mui-text-center">还没有相关订单哟~<p> 去商城<a href="{:url('index/index/index')}">逛逛</a></p></div>
                </div>
            </div>

{else}
            <div class="mui-slider-item mui-control-content mui-active">
                <ul class="mui-table-view">
                {volist name="arr" id="vo"}
                    <li class="mui-table-view-cell">
                        <div class="mui-clearfix zhuangtai">
                            订单编号：{$vo.order_sn}
                            {if condition="$vo.status eq 0"} 
                            {if condition="$vo.pay_status eq 0"} 
                            <a class="mui-pull-right txtlink">待付款</a>
                            {/if}
                            {if condition="$vo.pay_status eq 1"} 
                            <a class="mui-pull-right txtlink">待发货</a>
                            {/if}
                            {/if}
                            {if condition="$vo.status eq 1"} 
                            <a class="mui-pull-right txtlink">待收货</a>
                            {/if}
                            {if condition="$vo.status eq 2"} 
                            <a class="mui-pull-right txtlink">待评价</a>
                            {/if}
                            {if condition="$vo.status eq 3"} 
                            <a class="mui-pull-right txtlink">已完成</a>
                            {/if}
                            {if condition="$vo.status eq 4"} 
                            <a class="mui-pull-right txtlink">已取消</a>
                            {/if}
                            

                        </div>
                       {volist name="vo.goods" id="val"} 
                        <a href="#a" class="con">
                            <img src="__ROOT__/{$val.goods_pics}" class="mui-pull-left" alt="">
                            <div class="info mui-pull-right">
                                <p>{$val.goods_name}</p>
                                <div class="guigebox">
                                    <div class="guige mui-pull-left">￥{$val.buy_price}/个 <!-- <del>￥10.00/个</del> --></div>
                                    <div class="num mui-pull-right">x{$val.buy_num}</div>
                                </div>
                            </div>
                            <div class="mui-clearfix"></div>
                        </a>
                        {/volist}
                        
                        <p class="mui-text-right color-333 price">共{$vo.zong}件商品      合计：<span class="color-e40000">￥{$vo.real_money}</span> <span class="font12 color-666">含配送费￥{$vo.postfee}</span></p>
                        <ul>
                            

                            <li><a href="{:url('index/User/pingjia',array('oid'=>$vo['order_id']))}" class="mui-btn">再次购买</a></li>
                            
                            {if condition="$vo.status eq 2"} 
                            <li><a href="#" class="mui-btn mui-btn-danger">评价</a></li>
                            {/if}
                            {if condition="$vo.status neq 0"} 
                            <li><a href="#" class="mui-btn">再次购买</a></li>
                            {/if}
                            {if condition="$vo.status eq 0 and $vo.pay_status eq 0"} 

                            <li onclick="del({$vo.order_id});"><a href="javascript:" class="mui-btn">取消订单</a></li>
                            <li><a href="#" class="mui-btn mui-btn-danger">付款</a></li>
                            {/if}
                            <!-- {if condition="$vo.status neq 4"} 
                            <li><a href="#" class="mui-btn">联系客服</a></li>
                            {/if} -->
                        </ul>
                    </li>
                    {/volist}
                    
                </ul>
            </div>
             {/if}
        </div>
    </div>
    <script>
    function del(id){
    	alert(id);
    	var btnArray = ['取消', '确认'];
        mui.confirm('确认取消该订单吗？', '温馨提示', btnArray, function(e) {
            if (e.index == 1) {
            	
            
               url = "{:url('index/User/delorder')}";
            $.post(url, {id:id}, function (data) {
                if (data == 1) {
                	alert("取消成功");
                    //layer.msg("移除成功", {icon: 1, time: 1000});
                    window.location.reload();
                } else {
                    alert("取消失败");
                }
            })
       
            } else {
                console.log("取消了")
            }
        })
    }
        mui(".order-mui-tab").on('tap','a',function(){
            document.location.href=this.href;
        });
        $(function(){
            var documentHeight=$(window).height();
            $(".mui-slider-group").height(documentHeight-105)
        })
    </script>
</div>
</body>
</html>